﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JumploaderWrapper;

public partial class SingleImage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //same page process files
        if (Request.Files.Count > 0)
        {
            FileSystemFileSaver save = new FileSystemFileSaver(HttpContext.Current, "SingleImg\\");
            MultUploadHandler handle = new MultUploadHandler(save);
            handle.ProcessRequest(HttpContext.Current);

            Response.End();
            return;
        }

        jload.UploadURL = "/SingleImage.aspx";
        
        jload.Name = "jumpLoaderApplet";
        jload.LookAndFeel = JumploaderWrapper.JumploaderLookAndFeel.System;
        jload.FileTreeVisible = true;
        jload.FileListVisible = true;
        jload.DirectoryEnabled = true;
        jload.Width = Unit.Percentage(100);
        jload.Height = 600;

        jload.MaxFiles = 1; //increment this to test the all files done vs file done

        jload.fileNamePattern = "^.+\\.(?i)((jpg)|(jpe)|(jpeg))$"; //|(gif)|(png)
        jload.loadImageEditor = true;

        // jload.AppletParams.Add("vc_disableLocalFileSystem", "false");
        jload.AppletParams.Add("uc_imageRotateEnabled", "true");
        jload.AppletParams.Add("vc_uploadViewStartUploadButtonText", "Upload Picture");
        jload.AppletParams.Add("vc_uploadViewStartUploadButtonImageUrl", "JumploaderResource.asx?Resource=camera_add&Type=png");
        jload.AppletParams.Add("vc_uploadViewStopUploadButtonText", "Cancel Upload");
        jload.AppletParams.Add("vc_uploadViewStopUploadButtonImageUrl", "JumploaderResource.asx?Resource=camera_delete&Type=png");
        jload.AppletParams.Add("vc_uploadViewStopActionVisible", "true");

        jload.AppletParams.Add("uc_uploadScaledImages", "true");
        jload.AppletParams.Add("uc_scaledInstanceNames", "large, thumb");
        jload.AppletParams.Add("uc_scaledInstanceDimensions", "800x640xmax,100x80xcrop");
        jload.AppletParams.Add("uc_scaledInstanceQualityFactors", "700,700");
        jload.AppletParams.Add("vc_mainViewShowUploadErrors", "true");
        jload.AppletParams.Add("ac_fireUploaderFileStatusChanged ", "true");

        //uc_sendFilePath 
        //jload.AppletParams.Add("uc_uploadScaledImagesNoZip", "true");
        jload.AppletParams.Add("uc_removeUploadedFiles", "true");

    }
}